//
//  EmailValidator.swift
//  User
//
//  Created by ET|冰琳 on 2017/1/9.
//  Copyright © 2017年 IB. All rights reserved.
//

import Foundation


/// 邮箱验证
public class EmailValidator: NSObject, Validator {
    
    public func validate(txt: String?) -> Bool {
        
        let formate = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"
        let predicate = NSPredicate(format: "SELF MATCHES %@", formate)
        return predicate.evaluate(with: txt)
    }
}
